package moon.core.entity;

import moon.core.Name;
import moon.core.NamedObject;
import moon.core.ObjectMoon;
import moon.core.classdef.ClassDef;
import moon.core.classdef.MethDec;
import moon.core.classdef.Type;

/**
 * Entity.
 * 
 * @author <a href="mailto:rmartico@ubu.es">Ra&uacute;l Marticorena</a>
 * @since JavaMoon-1.3
 */
@SuppressWarnings("serial")
public abstract class Entity extends NamedObject{
	
	/**
	 * Type.
	 */
	private Type type;
	
	/**
	 * ClassDef.
	 */
	private ClassDef classDef;
	
	/**
	 * Gets the type.
	 * 
	 * @return type
	 * @see #setType
	 */
	public Type getType(){
		return type;
	}
	
	/**
	 * Sets the type.
	 * 
	 * @param type type
	 * @see #getType
	 */
	public void setType(Type type){
		this.type = type;		
	}
	
	/**
	 * Sets the class definition.
	 * 
	 * @param classDef class definition
	 * @see #getClassDef
	 */
	public void setClassDef(ClassDef classDef) {
		this.classDef = classDef;
	}
	
	/**
	 * Constructor.
	 * 
	 * @param name name
	 * @param type type
	 */
	public Entity(Name name, Type type){
		super(name);
		setType(type);		
	}
	
	/**
	 * Container class.
	 * 
	 * 
	 * @return container class
	 * @see #setClassDef
	 */
	public ClassDef getClassDef() {
		return classDef;
	}
	
	@Override
	public boolean equals(Object o) {
		return this.getId() ==  ((ObjectMoon) o).getId();
	}
	
} // Entity
